library httpsrv;
uses
  Core_Types in '..\..\Core_Types.pas',
  WND_SrvMain in 'WND_SrvMain.pas' {frmSrvMain},
  AppInterface in '..\AppInterface.pas';

var
  PluginInterface : TPluginInterface;
  MI_Proc : Integer;

function StartServer:Integer;
begin
  frmSrvMain.txtInitDir.Text := AppFace.UI_GetActiveList^.Path;
  frmSrvMain.Show;
  Result := 0;
end;

function PluginLoad(AppIntrfc : PAppInterface; PluginInt : PPluginInterface) : Integer;
begin
  PluginInterface.Name := 'HTTP Server';

  AppFace := AppIntrfc^;
  PluginInt^ := PluginInterface;

  if AppFace._Application = nil then
  begin
    AppFace.ConsolePrint('Error : VCL Application is not defined!');
    Result := -1;
    Exit;
  end;

  MI_Proc := AppFace.PE_RegisterProc(@StartServer);
  AppFace.UI_AddMenuItem('HTTP Server', MI_Proc);

  AppFace._Application.CreateForm(TfrmSrvMain, frmSrvMain);

  Result := 0;
end;

exports
  PluginLoad;

begin
end.
 